<h1>Statistiques</h1>

<table>
    <tr>
        <td>Référence</td>
        <td>Prix TTC unitaire</td>
        <td>CA TTC 2006</td>
        <td>CA % 2006</td>
        <td>CA TTC 2007</td>
        <td>CA % 2007</td>
        <td>CA TTC 2008</td>
        <td>CA % 2008</td>
        <td>CA TTC 2009</td>
        <td>CA % 2009</td>
    </tr>
    <?php foreach($this->items as $item) :  ?>
    <tr>
        <td><?php echo $item->reference ?></td>
        <td><?php echo $item->price ?></td>
        <?php
            foreach($this->turnovers as $key => $value){
                $begin = mktime(0,0,0,03,01,$key);
                $key++;
                $end =  mktime(23,59,59,02,28,$key);
                $itemTurnover = round($item->calculateTurnover($begin, $end), 2);
                $average = round($itemTurnover / $value, 4);
                $turnover = round($value,2);
                echo "<td>$itemTurnover € / $turnover €</td><td>$average %</td>";
            }
        ?>
        
    </tr>
    <?php endforeach ?>
</table>